<template>
	<view class="content" v-cloak v-if="!code">

	<!-- 	<image class="logo" :src="base.shareimage?base.shareimage:'@/static/logo.png'"></image>
		
		<view  style="margin-top:10vh;">
			
			<view>
				<u-button type="success" shape="circle"  @click="login">微信授权登录</u-button>
			</view>
			
			<view class="u-m-t-15 u-font-20" @click="see=!see" style="color: #848484;">
				<u-icon :name="see?'checkmark-circle-fill':'checkmark-circle'" :color="see?'#19be6b':'#848484'"></u-icon>
				<text >已阅读并同意</text> <text style="text-decoration: underline;text-underline-offset: 4rpx; " @click.stop="readagreement">用户协议 & 隐私政策</text>
				
			</view>
			
		</view>
		
		<v-agreement :show="showagreement" @close="showagreement=!showagreement"></v-agreement>
		 -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				see: true,
				showagreement: false,
				code: ''
			}
		},
		onLoad() {

		},
		onShow() {
			// 判断是否登录
			// #ifdef H5
			this.H5login();
			// #endif

		},
		methods: {
			readagreement() {
				this.showagreement = true
			},
			login() {

				if (!this.see) {
					uni.showToast({
						icon: 'none',
						title: '请先勾选隐私协议'
					})
					return;
				}
				this.$u.wx.wxOauth();
			},
			async H5login() {

				var that = this;

				
				this.$u.func.base(res => {
					// 处理获取基础信息后的内容

					uni.setNavigationBarTitle({
						title: that.base.title
					});
					
					that.$u.wx.noshare()
					
					if (that.userInfo && that.userInfo.fanstoken) {
						var backurl=uni.getStorageSync('backurl');
						backurl=backurl=='/pages/login/login'?'/pages/index/index':backurl
						setTimeout(function(){
							that.$u.route(backurl)
						},300)
						return;
					}
					
					// 判断是否授权回调code，如果是直接执行code拿取用户信息
					var code = that.$u.wx.getUrlCode().code;
					this.code = code;
					// that.$u.func.aliOauth();
					that.$u.wx.wxOauth();
					
					
				});
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>